package com.ty.controller;

import cn.hutool.core.bean.BeanUtil;
import com.ty.bean.Quote;
import com.ty.common.bean.Page;
import com.ty.common.bean.ResultBean;
import com.ty.common.controller.BaseController;
import com.ty.service.QuoteService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api( tags = "报价")
@RestController
@RequestMapping("/api")
public class QuoteController extends BaseController {

    @Autowired
    QuoteService quoteService;


    @ApiOperation("保存")
    @PostMapping("/quote")
     public ResultBean save(@RequestBody Quote quote){

        return saveResult(quoteService.save(quote));
    }

    @ApiOperation("报价")
    @PostMapping("/quote/list")
    public ResultBean query(@RequestBody Page page) {
        List list = quoteService.query();
        return success("报价列表", list);
    }


}
